function addHeadF(Fname, Ftype) {
    if (Ftype == "js") {
        var Fref = document.createElement('script');
        Fref.setAttribute("type", "text/javascript");
        Fref.setAttribute("src", Fname);
    } else if (Ftype == "css") {
        var Fref = document.createElement('link');
        Fref.setAttribute("rel", "stylesheet");
        Fref.setAttribute("type", "text/css");
        Fref.setAttribute("href", Fname);
    }

    if (typeof Fref != "undefined") {
        document.getElementsByTagName("head")[0].appendChild(Fref);
    }
}


function getfront(a, b) {
    foundoffset = a.indexOf(b);
    if (foundoffset == -1) {
        return null
    }
    return a.substring(0, foundoffset)
}
function getend(a, b) {
    foundoffset = a.indexOf(b);
    if (foundoffset == -1) {
        return null
    }
    return a.substring(foundoffset + b.length, a.length)
}
function delete_teacher_name() {
    if (window.location.href.indexOf("teacher_name") > 0) {
        var b = window.location.href;
        var a = getfront(b, "teacher_name=");
        var c = getend(b, "teacher_name=");
        var d = getend(c, "&");
        now_url = a + d;
        window.location.href = now_url
    } else {
        return null
    }
}
function toHlsSou() {
    var a = $("#find-inp").val();
    
    var query = '';
    if (a == '') {
       var url = "/index.php/Home/class/index";
        window.location.href = url;
    } else {
       var url = "/index.php/Home/class/index/?teacher_name=" + a + query;
        window.location.href = url;
    }
}
function getCookie(d) {
    var j = {};
    var h = document.cookie;
    if (h === "") {
        return j
    }
    var f = h.split("; ");
    for (var c = 0; c < f.length; c++) {
        var e = f[c];
        var b = e.indexOf("=");
        var a = e.substring(0, b);
        var g = e.substring(b + 1);
        g = decodeURIComponent(g);
        j[a] = g;
        if (d == a) {
            return g
        }
    }
    return null
}
function addCookie(a, b, e) {
    var f = a + "=" + escape(b);
    if (e > 0) {
        var d = new Date();
        var c = 24 * Number(e) * 3600 * 1000;
        d.setTime(d.getTime() + c);
        f += "; expires=" + d.toGMTString()
    }
    document.cookie = f + "; path=/;"
}
function delCookie(a) {
    var c = new Date();
    c.setTime(c.getTime() - 1);
    var b = getCookie(a);
    if (b != null) {
        document.cookie = a + "=" + b + ";expires=" + c.toGMTString() + ";path=/;domain=365hls.com"
    }
}
function GetQueryString(a) {
    reg = new RegExp("(^|&)" + a + "=([^&]*)(&|$)", "i");
    var b = window.location.search.substring(1).match(reg);
    if (b != null) {
        return unescape(b[2])
    }
    return null
}
function zlS_Script(a, d) {
    var b = document.createElement("script");
    b.type = "text/javascript";
    if (b.readyState) {
        b.onreadystatechange = function() {
            if (b.readyState == "loaded" || b.readyState == "complete") {
                b.onreadystatechange = null;
                d()
            }
        }
    } else {
        b.onload = function() {
            d()
        }
    }
    b.src = a;
    document.body.appendChild(b)
}
function contains(b, a) {
    if (b.contains) {
        return b != a && b.contains(a)
    } else {
        return !! (b.compareDocumentPosition(a) & 16)
    }
}
function checkHover(a, b) {
    if (getEvent(a).type == "mouseover") {
        return ! contains(b, getEvent(a).relatedTarget || getEvent(a).fromElement) && !((getEvent(a).relatedTarget || getEvent(a).fromElement) === b)
    } else {
        return ! contains(b, getEvent(a).relatedTarget || getEvent(a).toElement) && !((getEvent(a).relatedTarget || getEvent(a).toElement) === b)
    }
}
function getEvent(a) {
    return a || window.event
}
function yui() {
    addHeadF("/Public/Home/js/sishu_parent_common.js", "js");
    delCookie("ip_city");
    delCookie("city_pinyin");
    $(".nav_box li a").each(function() {
        $this = $(this);
        if ($this[0].href == String(window.location)) {
            $this.parent().addClass("cur").siblings().removeClass()
        } else {
            if ($this[0].href + "?Ua=isPc" == String(window.location)) {
                $this.parent().addClass("cur").siblings().removeClass()
            }
        }
    });
    $("#showCity li a").each(function() {
        $this = $(this);
        if ($this[0].href + "/beijing/" || "/wuhan/" || "/zhengzhou/" || $this[0].href + "/shijiazhuang/" || "/kunming/" || "/changchun/" || "/taiyuan/" || "/xian/" || "/changsha/" || "/jinan/" || "/haerbin/" || "/nanning/" == String(window.location)) {
            $(".nav_box li.home").addClass("cur")
        }
    });
    $(".mycenter>h2").click(function() {
        $(this).toggleClass("up");
        if (!document.body.hasAttribute("id")) {
            $(".mian_nav #sub_nav").toggle()
        }
    });
    function b() {
        $.post("/common/getsubcitys", null,
        function(e) {
            var h = e.res;
            var g = $("#showCity ul");
            var f = "";
            $("#getCity").text(h.my_city.name);
            for (i = 0; i < h.subcity.length; i++) {
                var j = h.subcity[i];
                if (h.my_city.name == j.name) {
                    f += '<li><span class="hover" data=' + j.id + " city=" + j.pinyin + ">" + j.name + "</span></li>"
                } else {
                    f += "<li><span data=" + j.id + " city=" + j.pinyin + ">" + j.name + "</span></li>"
                }
            }
            g.append(f);
            $("#showCity ul").find("li").on("click",
            function() {
                var l = $(this).text();
                var m = $(this).find("span").attr("data");
                var pinyin = $(this).find("span").attr("city");
                addCookie("ip_city", m, 24 * 360);
                addCookie("city_pinyin", pinyin, 24 * 360);
                $("#getCity").text(l);
                var k = $("#getCity").text().length;
                if (k > 2) {
                    if (k > 3) {
                        $("#showCity").attr("class", "showcy gt3")
                    } else {
                        $("#showCity").attr("class", "showcy gt2")
                    }
                } else {
                    $("#showCity").attr("class", "showcy")
                }
                $(".lateral-emerge").find("ul").empty();
                window.location = "/" + pinyin + "/";
                delete_teacher_name()
            })
        },
        "json")
    };
    $(".signup>a").click(function() {
        $("#zct,#register").css({
            display: "block"
        });
        $("#zct").height($("body").height());
        if ($("#zct").css("display") == "block") {
            $(document).keydown(function(f) {
                if (f.keyCode == 27) {
                    $(".bg-r-c-s").trigger("click")
                }
            })
        }
    });
    $(".closeyk-cards").click(function() {
        $(".page-yk ").css({
            display: "none"
        })
    });
    $(document).mouseup(function(g) {
        var f = $("#showCity");
        if (!f.is(g.target) && f.has(g.target).length === 0) {
            f.css("display", "none").stop(true).animate({
                opacity: "0",
                top: "76px",
                "z-index": "1"
            },
            240)
        }
    });
    if (GetQueryString("hash") == "regshow") {
        $("#zct,#register").css({
            display: "block"
        });
        $("#zct").height($("window").height())
    }
    var a, c = $("#logomask");
    c.mouseover(function() {
        clearTimeout(a);
        a = setTimeout(function() {
            var f = 0;
            var e = window.setInterval(function() {
                c.css("-webkit-mask", "-webkit-gradient(radial, 30 20, " + f + ", 30 20, " + (f + 50) + ", from(rgb(0, 0, 0)), color-stop(0.1, rgba(0, 0, 0, 0.1)), to(rgb(0, 0, 0)))");
                f++;
                if (f == 324) {
                    window.clearInterval(e)
                }
            },
            5)
        },
        350)
    });
    $(function() {
        var de;
        var hoverxxx = false;
        function setin() {
            de = setInterval(function() {
                if ($("#showCity").css("display") == "block" && donot == false && hoverxxx == false) {
                    $("#showCity").css("display", "none")
                }
            },
            2000)
        }
        $("#chancity,#getCity").mouseover(function() {
            $("#showCity").css("display", "block").stop(true).animate({
                opacity: "1",
                top: "64px",
                "z-index": "99"
            },
            240);
            donot = false;
            hoverxxx = true;
            setin()
        });
        $("#chancity,#getCity").mouseout(function() {
            hoverxxx = false;
            setTimeout(function() {
                clearInterval(de)
            },
            2000)
        });
        $("#showCity").mouseover(function() {
            $("#showCity").css("display", "block");
            donot = true
        });
        $("#showCity").mouseout(function() {
            $("#showCity").css("display", "none")
        })
    })
}
yui();
$(function() {

    $('.navl').find('li').each(function(index) {

        $(this).hover(function() {

            var e = index;

            $(this).addClass('hover').siblings().removeClass('hover');

            $('.lists').find('div:eq(' + e + ')').slideDown().siblings().slideUp();

        });

    });

    $('.flot.bn.more').find('a:first').addClass('so');

    $('.flot.bn.more').find('a').each(function() {

        $(this).click(function(event) {

            if (!$(this).hasClass('mor')) event.preventDefault();

            var name = 'km-' + $(this).attr('name');

            $(this).parents('section').find('div.' + name).fadeIn(250).siblings('div.gr-Teacher').hide();

            $(this).addClass('so').siblings('a').removeClass('so');

        });

    });

})

function addHeadF(Fname, Ftype) {
    if (Ftype == "js") {
        var Fref = document.createElement('script');
        Fref.setAttribute("type", "text/javascript");
        Fref.setAttribute("src", Fname);
    } else if (Ftype == "css") {
        var Fref = document.createElement('link');
        Fref.setAttribute("rel", "stylesheet");
        Fref.setAttribute("type", "text/css");
        Fref.setAttribute("href", Fname);
    }
    // if (typeof Fref != "undefined") {
    //     //document.getElementsByTagName("head")[0].appendChild(Fref);
    // }
}
function u() {
    $("#arrowup").click(function(e) {
        e.preventDefault();
        $("html,body").animate({
            scrollTop: 0
        },
        500);
    });
    $(window).scroll(function() {
        var _offseT = $(window).scrollTop();
        if (_offseT >= 1000) {
            $('#arrowup').fadeIn(200);
        } else {
            $('#arrowup').fadeOut(50);
        }
    });
};
u();